#include "Shm.hpp"
#include "namedPipe.hpp"

// 客户端
int main()
{
    // 1. 客户端获取共享内存
    Shm shm(gpathname, gproj_id, gUser);
    // 获取后清空共享内存
    shm.Zero();
    char *shmaddr = (char *)shm.Addr();
    sleep(3);

    // 2. 打开管道
    NamePiped fifo(comm_path, User);
    fifo.OpenForWrite();
    // 2. 客户端进行写入
    char ch = 'A';
    while (ch <= 'Z')
    {
        shmaddr[ch - 'A'] = ch;
        std::string temp = "wakeup";
        std::cout << "add " << ch << " into Shm, " << "wakeup reader" << std::endl;
        ch++;
        fifo.WriteNamedPipe(temp);
        sleep(2);
    }
    return 0;
}